package com.yunshang.ys.ys;

import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

/**
 * Created by Administrator on 2017/6/25.
 */

public abstract class YSActivity extends AppCompatActivity {

    ProgressDialog progressDialog;

    public abstract YSActivity showTitle(String titleName);

    public abstract YSActivity withBack();

    public abstract YSActivity withRightText(String text, View.OnClickListener onClickListener);

    public abstract YSActivity withRightIcon(int iconResourceId, View.OnClickListener onClickListener);


    public void showProgressDialog(String message, boolean cancelAble) {

//        SingleProgressDialog.getInstance(getApplicationContext(),false).show();

        if (progressDialog == null) {
            progressDialog = new ProgressDialog(this);
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        }
        progressDialog.setMessage(message);
        progressDialog.setCancelable(cancelAble);
        if (!progressDialog.isShowing())
            progressDialog.show();

    }

    public void dismissProgressDialog() {

        if (progressDialog != null) {
            progressDialog.dismiss();
        }
//        SingleProgressDialog.getInstance(getApplicationContext(),false).dismiss();
//        ((RisApplication)getApplicationContext()).dis(progressDialog);
    }
}


